package com.googlecode.tracey.ui.core;

import com.googlecode.totallylazy.Callable1;

import java.util.ArrayList;
import java.util.List;

public class MessageServers {
    private final List<MessageServer> messageServers = new ArrayList<MessageServer>();

    public MessageServers add(MessageServer messageServer) {
        messageServers.add(messageServer);
        return this;
    }

    public List<MessageServer> messageServers() {
        return messageServers;
    }

    public static Callable1<MessageServer, MessageServers> addTo(final MessageServers messageServers) {
        return new Callable1<MessageServer, MessageServers>() {
            @Override
            public MessageServers call(MessageServer messageServer) throws Exception {
                return messageServers.add(messageServer);
            }
        };
    }
}
